fix: prevent ariadne from panicking on empty stdin/file#1588
Merged
mightyiam merged 4 commits intomolybdenumsoftware:masterfrom Apr 26, 2026
Merged
fix: prevent ariadne from panicking on empty stdin/file#1588mightyiam merged 4 commits intomolybdenumsoftware:masterfrom
mightyiam merged 4 commits intomolybdenumsoftware:masterfrom
Conversation
Member
|
How about a test for this? |
Author
|
Yea exactly i actually made a test last night. Will raise a pr in the evening after college ends |
0f1a07c to
11230da
Compare
mightyiam
reviewed
Apr 8, 2026
mightyiam
reviewed
Apr 9, 2026
821c749 to
544dcf8
Compare
mightyiam
reviewed
Apr 10, 2026
Member
|
Some conflicts |
Author
|
On it |
544dcf8 to
f8088d2
Compare
Author
|
Should be good now. handles empty stdin and files now. Now it returns |
mightyiam
reviewed
Apr 23, 2026
Author
|
I checked the lock file and turns out ariadne crate quite outdated. statix is using v0.1.3. latest is 0.6.0 which also fixes the empty stdin panic we are trying to solve. other additional change required would be in traits.rs,change to Post update it now returns |
e647aa6 to
9b5d439
Compare
- Add missing Stdio import in _utils.rs to fix compile error - Fix indentation in test_cli_stdin function - Update CliReport::build to use ariadne 0.6.0 range tuple API - Add tests for empty stdin and empty file error handling
5d36332 to
2f77f36
Compare
mightyiam
reviewed
Apr 25, 2026
Replace manual min-offset computation with Report::total_diagnostic_range(), passing the full diagnostic range to CliReport::build instead of a zero-width span. This gives ariadne accurate span information for the report header.
Member
|
Thank you, @daschinmoy21! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes oppiliappan#78
When statix receives an empty string via stdin, an empty Report is generated. Passing an empty string to ariadne's Source::from causes an index out of bounds panic. Supplying a string with a single space as a fallback prevents this panic while keeping the error location at byte offset 0.
Output after this fix-
echo "" | nix run . -- check -s
[E00] Error: Syntax error
╭─[:1:1]
│
1 │
· │
· ╰─ Unexpected end of file
───╯